<?php echo $this->element('displayHeader'); ?>
<div class="toolbar">
    <div id="tLeft">
        <?php echo $this->element('toolbar', array('buttons' => array('back'))); ?>
    </div>
    <div id="tRight"><?php echo $this->element('neighbors', array('model' => 'Product', 'title' => 'part_no')); ?></div>
</div>

<fieldset>
    <legend>General Information</legend>
    <table class="wide">
        <tr>
            <td width="150px"><?php echo $form->label('Product.supplier_part_no', 'Vendor Part no.') ;?></td>
            <td colspan="3"><?php echo $this->data['Product']['supplier_part_no'] ?></td>
        </tr>
        <tr>
            <td><?php echo $form->label('Product.category_id') ;?></td>
            <td width="350px"><?php echo isset($this->data['Category']['name'])? $this->data['Category']['name'] : '-' ?></td>
            <td width="100px"><?php echo $form->label('Product.brand_id') ;?></td>
            <td><?php echo $this->data['Brand']['name'] ?></td>
        </tr>
        <tr>
            <td><?php echo $form->label('Product.model') ;?></td>
            <td><?php echo $this->data['Product']['model'] ?></td>
            <td><?php echo $form->label('Product.unit_id', 'Unit') ?></td>
            <td><?php echo $this->data['Unit']['title']; ?></td>
        </tr>
        <tr>
            <td class="top"><?php echo $form->label('Product.title') ;?></td>
            <td colspan="3"><?php echo $this->data['Product']['title'] ?></td>
        </tr>
        <tr>
            <td class="top"><?php echo $form->label('Product.text', 'Description') ;?></td>
            <td colspan="3"><?php echo $this->data['Product']['text'] ?></td>
        </tr>
    </table>
</fieldset>

<fieldset>
    <legend>Barcode</legend>
    <table class="wide">
        <tr>
            <td width="150px">&nbsp;</td>
            <td>
                <?php if (isset($this->data['Product']['has_barcode']) && $this->data['Product']['has_barcode']) : ?>
                <img src="<?php echo "{$this->base}/products/barcode_image/{$this->data['Product']['id']}" ?>" alt="barcode image" />
                <?php else : ?>&nbsp;
                <?php endif; ?>
            </td>
        </tr>
    </table>
</fieldset>

<fieldset>
    <legend>Picture</legend>
    <table class="wide">
        <tr>
            <td class="center">
                <?php if (isset($this->data['Product']['has_picture_1']) && $this->data['Product']['has_picture_1']) : ?>
                <img src="<?php echo "{$this->base}/products/product_image/{$this->data['Product']['id']}/1" ?>" alt="Picture image 1" /><br />
                <?php else : ?>&nbsp;
                <?php endif; ?>
            </td>
            <td class="center">
                <?php if (isset($this->data['Product']['has_picture_2']) && $this->data['Product']['has_picture_2']) : ?>
                <img src="<?php echo "{$this->base}/products/product_image/{$this->data['Product']['id']}/2" ?>" alt="Picture image 2" /><br />
                <?php else : ?>&nbsp;
                <?php endif; ?>
            </td>
        </tr>
    </table>
</fieldset>

<div id="custProduct">
    <?php if ($session->check('ItsCustProducts.customer_id')) : ?>
        <?php echo $this->requestAction("/its_cust_products/view/customer_id:{$session->read('ItsCustProducts.customer_id')}/product_id:{$this->data['Product']['id']}", array('return')); ?>
    <?php else : ?>
        <?php echo $this->requestAction("/its_cust_products/view/product_id:{$this->data['Product']['id']}", array('return')); ?>
    <?php endif; ?>
</div>